$def with (form)

$var title: $("Log In")

<div id="contentHead">
    <h1>$_("Log In")</h1>
</div>

<div id="contentBody">
  $if not ctx.user:
      <p>$:_('Please enter your <a href="https://archive.org">Internet Archive</a> email and password to access your Open Library account.')</p>

  $if ctx.user:
      <p>$:_("You are already logged into Open Library as %(user)s.", user='<a href="%s">%s</a>' % (ctx.user.key, ctx.user.displayname))</p>
      <p>$:_('If you\'d like to create a new, different Open Library account, you\'ll need to <a href="javascript:;" onclick="document.forms[\'logout\'].submit()">log out</a> and start the signup process afresh.')</p>

  $else:
      <form id="register" class="login olform" name="register" method="post">

        $if form.note:
            <div class="note">$form.note</div>

        <div class="formElement">
            <div class="label">
              <label for="username">$_("Email")</label>
              <span class="smaller lighter"></span>
              &mdash; <a class="forgot-email" href="/account/email/forgot-ia">$_('Forgot your Internet Archive email?')</a>
            </div>

            <div class="input">
              <input type="email" class="required" id="username" name="username" value="$(form.username.value or query_param('username'))" placeholder="Email" autocapitalize="off" autocorrect="off"/>
              <span class="invalid clearfix" htmlfor="username">$form.username.note</span>
            </div>
        </div>

        <div class="formElement">
            <div class="label"><label for="password">$_("Password")</label> <span class="smaller lighter"></span></div>
            <div class="input">
                <input type="password" class="required" placeholder="Password" id="password" name="password" value="$form.password.value" />
                <span class="invalid clearfix" htmlfor="password">$form.password.note</span>
            </div>
        </div>

        <div class="formElement">
            <div class="input">
                <input name="remember" type="checkbox" id="remember" />
                <label for="remember" class="small">$_('Remember me')</label>
            </div>
        </div>

        <input type="hidden" id="redirect" value="$form.redirect.value" name="redirect" />
        <input type="hidden" id="debug_token" value="" name="debug_token"/>

        <div class="clearfix"></div>

        <div class="formElement bottom">
            <br/>
            <input value="$_('Log In')" type="submit" class="login-submit" name="login" title="$_('Log In')"/>
        </div>
        <div class="formElement">
            <div class="label"></div>
            <div class="input smaller"><a href="https://archive.org/account/login.forgotpw.php">$_('Forgot your Password?')</a>
            <br/><br/>
            $:_('Not a member of Open Library? <a href="/account/create">Sign up now</a>.')</div>
        </div>
    </form>
</div>
